package com.boom.springapp.mystarterautoconfigure.service;

import com.boom.springapp.mystarterautoconfigure.properties.HelloProperties;

/**
 * @author hhl
 * @version 1.0
 * @description
 * @date 2025/8/24 22:49
 */

public class HelloService {

    private final HelloProperties properties;

    public HelloService(HelloProperties properties) {
        this.properties = properties;
    }

    /**
     * 生成欢迎语
     */
    public String sayHello() {
        return properties.getPrefix() + " " + properties.getDefaultName() + "!";
    }

    /**
     * 生成指定名称的欢迎语
     */
    public String sayHello(String name) {
        return properties.getPrefix() + " " + name + "!";
    }

    /**
     * 获取配置属性
     */
    public HelloProperties getProperties() {
        return properties;
    }
}